<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/template/crud.xhtml">
	<ui:param name="idForm" value="frmUsuario" />
	<ui:param name="prependId" value="false" />
	<ui:param name="backingBeanName" value="#{userBean}" />
	<ui:param name="complementTitle" value="#{msgs['label.user']}" />
	<ui:define name="spaceFields">
		<h:panelGrid columns="2" styleClass="panelGrid">
			<h:outputLabel value="#{msgs['label.name']}:" for="name" />
			<h:outputLabel value="#{msgs['label.email']}:" for="email" />

			<p:inputText id="name" value="#{userBean.domain.name}" maxlength="80" styleClass="inputText"
				required="#{userBean.requiredOnInsEdi}" disabled="#{userBean.disabledOnDefaultPreview}" onkeyup="toUpperCase(this);"
				requiredMessage="#{msgs['msg.error.required.name']}" />

			<p:inputText id="email" value="#{userBean.domain.email}" styleClass="inputText" required="#{userBean.requiredOnInsEdi}"
				disabled="#{userBean.disabledOnDefaultPreview}" requiredMessage="#{msgs['msg.error.required.email']}"
				validatorMessage="#{msgs['msg.error.validade.emailInvalid']}">
				<f:validateRegex pattern="^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$" />
				<p:ajax immediate="true" event="blur" global="false" />
			</p:inputText>

			<h:outputLabel value="#{msgs['label.login']}:" for="login" />

			<h:panelGroup layout="block">
				<h:panelGrid columns="2" styleClass="panelGrid" columnClasses="width137">
					<h:outputLabel value="#{msgs['label.password']}:" for="password" />
					<h:outputLabel value="#{msgs['label.confirm']}:" for="passwordConfirm" />
				</h:panelGrid>
			</h:panelGroup>

			<p:inputText id="login" value="#{userBean.domain.login}" maxlength="20" styleClass="inputText"
				required="#{userBean.requiredOnInsEdi}" disabled="#{userBean.disabledOnDefaultPreview}"
				requiredMessage="#{msgs['msg.error.required.login']}" />

			<h:panelGroup layout="block">
				<h:panelGrid columns="3">
					<p:password id="password" value="#{userBean.domain.password}" required="#{userBean.requiredOnInsEdi}"
						disabled="#{userBean.disabledOnDefaultPreview or userBean.disabledOnSearch}" label="#{msgs['label.password']}"
						requiredMessage="#{msgs['msg.error.required.password']}" maxlength="18">
						<f:validateLength minimum="6" maximum="18" />
					</p:password>
					<p:password id="passwordConfirm" value="#{userBean.passwordConfirm}" required="#{userBean.requiredOnInsEdi}"
						disabled="#{userBean.disabledOnDefaultPreview or userBean.disabledOnSearch}" label="#{msgs['label.passwordConfirmation']}"
						requiredMessage="#{msgs['msg.error.required.passwordConfirm']}" maxlength="18">
						<f:validateLength minimum="6" maximum="18" />
					</p:password>
				</h:panelGrid>
			</h:panelGroup>
		</h:panelGrid>
	</ui:define>

	<ui:define name="tableColumn">
		<ui:param name="usingDataTableDefault" value="false" />
		<p:column styleClass="width5">
			<f:facet name="header">
				<h:outputText value="#{msgs['label.id']}" />
			</f:facet>
			<h:outputText value="#{obj.id}" />
		</p:column>
		<p:column>
			<f:facet name="header">
				<h:outputText value="#{msgs['label.name']}" />
			</f:facet>
			<h:outputText value="#{obj.name}" />
		</p:column>
		<p:column>
			<f:facet name="header">
				<h:outputText value="#{msgs['label.login']}" />
			</f:facet>
			<h:outputText value="#{obj.login}" />
		</p:column>
		<p:column>
			<f:facet name="header">
				<h:outputText value="#{msgs['label.email']}" />
			</f:facet>
			<h:outputText value="#{obj.email}" />
		</p:column>
	</ui:define>
</ui:composition>